#include <stdio.h>
#include <stdlib.h>

int main()
{
    int a[10]={50,40,30,20,10,60,70,80,90,100},i,num_i,gap,l;
    while(1) {
        scanf("%d",&l);
        if(l==0) {
            break;
        }
        long min=labs((long)a[0]-(long)l);
        int min_i=0;
        for( i=0; i<10; i++) {
            long t=labs((long)a[i]-(long)l);
            if(t<min||(t==min&&a[i]<a[min_i])) {
                min = t;
                min_i = i;
            }
        }
        printf("%d\n",a[min_i]);
    }
}